package com.example.pool;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class FtpClientController {
    @GetMapping("/ftpTest")
    public String test() {
        FTPClientConfig conf = new FTPClientConfig();
        conf.setHost("172.22.186.125");
        conf.setUsername("ftpuser0");
        conf.setPassword("12345678");
        System.out.println("Connecting to " + conf);
        FTPClientFactory factory = new FTPClientFactory();
        factory.setFtpPoolConfig(conf);
        FTPClientPool pool = new FTPClientPool(factory);
        FTPClientHelper clientHelper = new FTPClientHelper();
        clientHelper.setFtpClientPool(pool);
        clientHelper.listFiles("/");
        return "ftpTest is running";
    }
}
